package com.lottery.material.service.admin.transaction.impl;

import com.lottery.material.dao.transaction.UserBuyRecordMapper;
import com.lottery.material.pojo.transaction.UserBuyRecord;
import com.lottery.material.service.admin.transaction.UserBuyRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Description：用户充值记录服务接口实现类
 * Created by 朱正磊 on 2019-04-20 17:02
 */
@Service("adminUserBuyRecordService")
public class UserBuyRecordServiceImpl implements UserBuyRecordService {
    
    private final UserBuyRecordMapper userBuyRecordMapper;

    @Autowired
    public UserBuyRecordServiceImpl(UserBuyRecordMapper userBuyRecordMapper) {
        this.userBuyRecordMapper = userBuyRecordMapper;
    }

    /**
     * description：新增一条数据
     * user 朱正磊
     * time 2019-04-20 15:14
     * @param userBuyRecord 对象
     * @return 返回持久化操作数据库状态值
     */
    @Override
    public Integer add(UserBuyRecord userBuyRecord) {
        return userBuyRecordMapper.insertSelective(userBuyRecord);
    }

    /**
     * description：根据主键物理删除
     * user 朱正磊
     * time 2019-04-20 15:13
     * @param id 主键
     * @return 返回持久化操作数据库状态值
     */
    @Override
    public Integer deleteById(Integer id) {
        return userBuyRecordMapper.deleteByPrimaryKey(id);
    }

    /**
     * description：根据主键查询唯一数据
     * user 朱正磊
     * time 2019-04-20 15:15
     * @param id 主键
     * @return 返回唯一数据
     */
    @Override
    public UserBuyRecord findById(Integer id) {
        return userBuyRecordMapper.selectByPrimaryKey(id);
    }

    /**
     * description：根据主键修改一条数据
     * user 朱正磊
     * time 2019-04-20 15:16
     * @param userBuyRecord 对象
     * @return 返回持久化操作数据库状态值
     */
    @Override
    public Integer updateById(UserBuyRecord userBuyRecord) {
        return userBuyRecordMapper.updateByPrimaryKeySelective(userBuyRecord);
    }
    
}
